<template>
  <div>
    <!-- 商品分类管理 -->
    <div class="topName">
      <div style="display: flex; align-items: center">
        <img
          style="width: 20px; height: 18px; margin: 0 10px"
          src="../../../assets/img/3.png"
          alt=""
          :isCollapse="true"
        />
        <el-button type="primary">商品分类管理</el-button>
      </div>
    </div>
    <div class="fff">
      <br />
      <div class="search">
        <div class="left_search"></div>

        <div class="right_search">
          <el-button type="primary" @click="add" class="btn"
            >添加分类</el-button
          >
        </div>
      </div>

      <!-- 表格 -->
      <el-table
        :data="tableData"
        :header-cell-style="{ background: '#ECF4FF', color: '#333' }"
        style="width: 50%; margin-bottom: 20px; margin-left: 10px"
        row-key="id"
        border
        default-expand-all
        stripe
      >
        <el-table-column type="selection" />

        <el-table-column prop="name" label="分类名称" align="center" />

        <!-- 操作 -->
        <el-table-column fixed="right" label="操作" align="center" width="239">
          <template #default="scope">
            <el-button
              link
              type="danger"
              size="small"
              @click.prevent="deleteRow()"
            >
              删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { ref } from "vue";
import { useRouter, useRoute } from "vue-router";
// css
import "../../../assets/css/size.css";

const router = useRouter();

// 表格数据
const tableData = [
  {
    id: 3,
    date: "2016-05-01",
    name: "一级分类",
    address: "No. 189, Grove St",
    children: [
      {
        id: 31,
        date: "2016-05-01",
        name: "二级分类",
        address: "No. 189, Grove St",
      },
      {
        id: 32,
        date: "2016-05-01",
        name: "三级分类",
        address: "No. 189, Grove St",
      },
    ],
  },
];

const add = () => {
  router.push("/commoditySortAdd");
};

// 删除
const deleteRow = () => {};
</script>

<style lang="scss" scoped>
.search {
  // width: 1061px;
  margin: 0 0 20px 10px;
  display: flex;
  align-items: center;
  // justify-content: space-between;
}
.fff {
  // width: 1610px;
  height: 930px;
  background: #ffffff;
  opacity: 1;
  border-radius: 0px;
  margin-left: 10px;
}
</style>
